import React from "react";
// 引入主布局组件
import MainLayout from "../components/mainLayout";
// 引入路由的类型
import { RouteRawState } from "../types";
// 懒加载
const Home = React.lazy(() => import("../views/home"));
const List = React.lazy(() => import("../views/list"));
const Login = React.lazy(() => import("../views/login"));
const Set = React.lazy(() => import("../views/set"));
const Regist = React.lazy(() => import("../views/regist"));

// 定义路由表
export const Route_List: RouteRawState[] = [
  {
    path: "/",
    element: (
      <MainLayout>
        <Home></Home>
      </MainLayout>
    ),
    title: "首页",
    requireLogin: true
  },
  {
    path: "/list",
    element: (
      <MainLayout>
        <List></List>
      </MainLayout>
    ),
    title: "列表",
    requireLogin: true
  },
  {
    path: "/set",
    element: (
      <MainLayout>
        <Set></Set>
      </MainLayout>
    ),
    title: "设置",
    roles: ['admin'],
    requireLogin: true
  },
  {
    path: "/regist",
    element: <Regist></Regist>,
    title: "注册",
    // 代表导航菜单不渲染
    hidden: true,
  },
  {
    path: "/login",
    element: <Login></Login>,
    title: "登录",
    // 代表导航菜单不渲染
    hidden: true,
  },
];
